package neuron.library.ga.replication;

import java.util.Random;

import neuron.library.ga.AbstractGeneticMachine;
import neuron.library.ga.common.Population;

/*
 * Replicates single elite chromosome.
 */
public class EliteLowRateReplication extends ReplicationStrategy {

	public EliteLowRateReplication(AbstractGeneticMachine gm) {
		super(gm);
	}

	@Override
	public void replication(Population population) {
		Random rand = new Random();
		
		if (rand.nextInt(1000)%1000 == 0) {
			population.sortPopulation();
			population.add(population.get(0));
		}
	}

}
